#include "octopod.h"
#include "tcpsocket.h"
#include <gtest/gtest.h>

namespace {

// The fixture for testing class Foo.
class TCPListenSocketTest : public ::testing::Test {
 protected:
  // You can remove any or all of the following functions if its body
  // is empty.

  // If the constructor and destructor are not enough for setting up
  // and cleaning up each test, you can define the following methods:

  virtual void SetUp() {
    // Code here will be called immediately after the constructor (right
    // before each test).
    QHostAddress *q = new QHostAddress("127.0.0.1");
    n.set_hostaddr(q);
    n.set_port(48543);
  }

  // Objects declared here can be used by all tests in the test case for Foo.
  octopod::NetworkAddress n;
  octopod::TCPListenSocket t;
};

// Tests that the Foo::Bar() method does Abc.
TEST_F(TCPListenSocketTest, ListenOnLocalhost) {
  EXPECT_EQ(t.listen(n), octopod::Socket::kOk);
}

}  // namespace
